import { EntityModel } from '@midwayjs/orm';
import { BaseEntity } from '@cool-midway/core';
import { Column, JoinColumn, ManyToOne } from 'typeorm';
import { WeiboBlogEntity } from './blog';

/**
 * 商品
 */
@EntityModel('weibo_blog_photo')
export class WeiboBlogPhotoEntity extends BaseEntity {
  @Column({ comment: 'blog.id', type: 'varchar', name: 'blog_id' })
  blogId: number;

  @Column({ comment: '图片', type: 'varchar' })
  image: string;

  @ManyToOne(() => WeiboBlogEntity, blog => blog.photos)
  @JoinColumn([{ name: 'blog_id', referencedColumnName: 'id' }])
  blog: WeiboBlogEntity;
}
